home
***
CD-ROM
|
disk
|
other
***
search
/
SGI Hot Mix 8
/
Hot Mix 8.iso
/
.all
/
demos
/
ICS
/
mklinks.bx
(
.txt
)
< prev
Wrap
Text File
|
1994-06-22
|
18KB
|
770 lines
#!/bin/sh
# Links script for Builder Xcessory
# Set DEBUGYN to Y in order to run in debug mode.
DEBUGYN=N
DEBUG()
{
if test "$DEBUGYN" != "Y"
then
$@
fi
}
#
# For systems which don't support mkdir -p, we use mkdirhier
# adapted from the mkdirhier.sh script in the X11 distribution.
#
Mkdirhier()
{
for f in $*; do
parts=`echo $f | sed 's,\(.\)/\(.\),\1 \2,g' | sed 's,/$,,'`;
path="";
for p in $parts; do
if [ x"$path" = x ]; then
dir=$p;
else
dir=$path/$p;
fi;
if [ ! -d $dir ]; then
mkdir $dir;
chmod a+rx $dir;
fi;
path=$dir;
done;
done
}
Log()
{
echo $1 >> $LOGFILE
echo $1
}
Clear()
{
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
}
Title()
{
echo "================================================================================"
echo "$1"
echo "================================================================================"
}
Status()
{
OUT=$1
echo ""
${OUT} "[1] BX Home Directory: $TMP_DEST"
${OUT} "[2] Binary Linked in: $BIN_DEST"
${OUT} "[3] AppDefaults Linked in: $APP_DEST"
${OUT} "[4] Manpages Linked in: $MAN_DEST"
${OUT} "[5] X Data Files Located in: $SERVERLIB"
}
PromptUser()
{
CONTINUE=NO
while test "$CONTINUE" = "NO"
do
echo "$1 (? for Help)"
echo ${DASHN} "[$2]->${SLASHC}"
read INPUT
case "$INPUT"
in
\?)
InstallHelp
;;
*)
if test "$INPUT" = ""
then
USERPROMPT="$2"
else
USERPROMPT="$INPUT"
fi
CONTINUE=YES
;;
esac
done
}
AwaitEnter()
{
ESCAPE=N
echo ${DASHN} "Press [ENTER] to continue [X] to escape...${SLASHC}"
read INPUT
case "$INPUT"
in
[xX])
ESCAPE=Y
;;
*)
ESCAPE=N
;;
esac
}
InstallHelp()
{
Title "Builder Xcessory Link Installation Help: $HELPTITLE"
case "$HELP"
in
linkmain)
echo ""
echo ""
echo ""
echo "BX Home Directory - indicates the directory in which all BX files"
echo " will reside. This directory must be writable"
echo " and large enough to hold the BX distribution."
echo " On systems which support symbolic file links,"
echo " This is the only location in which BX files"
echo " physically reside. All other changes are"
echo " symbolic file links."
echo ""
echo ""
echo "Binary Linked in - indicates directory in which a link to the BX"
echo " binary will appear."
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
AwaitEnter
if test "$ESCAPE" = "Y"
then
return
fi
Title "Builder Xcessory Link Installation Help: $HELPTITLE"
echo ""
echo "AppDefaults Linked in - indicates directory in which a link to the"
echo " Builder Xcessory application defaults file"
echo " will appear."
echo ""
echo "Manpages Linked in - indicates the top of the manual page directory."
echo " Manual pages for the Builder Xcessory and"
echo " Flexible License Manager will be linked in"
echo " the appropriate sub-directories."
echo ""
echo "X Data Files Located in - indicates the directory in which various X"
echo " data files are located. The installation"
echo " scripts examines the XKeysymDB file in this"
echo " directory to determine if the OSF Virtual Keysyms"
echo " are defined. If they are not, they are added to"
echo " the XKeysymDB in this directory."
echo ""
echo ""
echo ""
echo ""
AwaitEnter
;;
ow)
echo ""
echo "Under OpenWindows, the following directories are located differently than the"
echo "corresponding directories in the MIT Sample X Implementation."
echo ""
echo ""
echo " MIT OpenWindows"
echo " -----------------------------------------------------------"
echo ""
echo " /usr/lib/X11 /usr/openwin/lib"
echo " /usr/lib/X11/app-defaults /usr/openwin/lib/app-defaults"
echo " /usr/bin/X11 /usr/openwin/bin"
echo " /usr/man/* /usr/openwin/man/*"
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
AwaitEnter
;;
*)
;;
esac
Clear
}
#
# Try to get a reasonable default for the tape drive.
# Do not change the SYSTEM=sgi5 line.
SYSTEM=sgi5
FROM_DIR=`pwd`
WHERE=tape
DASHN=-n
SLASHC=" "
UNCOMPRESS=n
SHORT_NAMES=n
OPENWIN=n
CATMAN=n
LN="ln -s"
SH=/bin/sh
MKDIR="mkdir -p"
case $SYSTEM
in
mips)
TPDRIVE=/dev/rmt/h0
DASHN=""
SLASHC=" \c"
NO_LMGR="y"
HOSTNAME=`/usr/net/hostname`
;;
ibm)
TPDRIVE=/dev/rmt1
DASHN=""
SLASHC=" \c"
MKDIR="Mkdirhier"
HOSTNAME=`/bin/hostname`
;;
sun4f)
TPDRIVE=/dev/rfd0
UNCOMPRESS=y
OPENWIN=y
HOSTNAME=`/bin/hostname`
;;
sun4)
TPDRIVE=/dev/rst8
OPENWIN=y
HOSTNAME=`/bin/hostname`
;;
sun3)
TPDRIVE=/dev/rst8
OPENWIN=y
HOSTNAME=`/bin/hostname`
;;
88open)
TPDRIVE=/dev/rmt/0
SHORT_NAMES=y
DASHN=""
SLASHC=" \c"
HOSTNAME=`/usr/ucb/hostname`
;;
dg)
CATMAN="y"
TPDRIVE=/dev/rmt/0
SHORT_NAMES=y
DASHN=""
SLASHC=" \c"
HOSTNAME=`/usr/ucb/hostname`
;;
ds3100)
TPDRIVE=/dev/rmt0h
SH=/bin/sh5
DASHN=""
SLASHC=" \c"
HOSTNAME=`/bin/hostname`
;;
vax)
TPDRIVE=/dev/rmt0h
;;
sgi)
TPDRIVE=/dev/tapens
DASHN=""
SLASHC=" \c"
HOSTNAME=`/usr/bsd/hostname`
;;
sony)
TPDRIVE=/dev/rst8
HOSTNAME=`/usr/hostname`
;;
sony-svsv)
TPDRIVE=/dev/rst8
DASHN=""
SLASHC=" \c"
HOSTNAME=`/usr/ucb/hostname`
;;
mac)
TPDRIVE=`pwd`/bx.tar.Z
DASHN=""
MKDIR="Mkdirhier"
SLASHC=" \c"
NO_LMGR="y"
SHORT_NAMES=y
HOSTNAME=`/bin/hostname`
;;
sco)
UNCOMPRESS=y
TPDRIVE=/dev/fd0
DASHN=""
SLASHC=" \c"
SHORT_NAMES=y
LN="cp"
HOSTNAME=`/usr/bin/hostname`
;;
interactive)
TPDRIVE=/dev/rst8
SHORT_NAMES=y
LN="cp"
NO_LMGR="y"
HOSTNAME=`/usr/ucb/hostname`
;;
ingr)
TPDRIVE=/dev/rmt/0m
SHORT_NAMES=y
DASHN=""
SLASHC=" \c"
CATMAN="y"
HOSTNAME=`/bin/hostname`
;;
hp400)
TPDRIVE=/dev/rct/c0
DASHN=""
SLASHC=" \c"
OPENWIN=n
SHORT_NAMES=y
HOSTNAME=`/bin/hostname`
;;
hp700)
TPDRIVE=/dev/rmt/0m
DASHN=""
SLASHC=" \c"
OPENWIN=n
SHORT_NAMES=y
HOSTNAME=`/bin/hostname`
;;
other)
TPDRIVE=/dev/rmt/Q24-0
HOSTNAME=`/bin/hostname`
;;
*)
TPDRIVE=/dev/rst8
HOSTNAME=`/bin/hostname`
;;
esac
#
# Installation on an Open Windows platform uses different directories
#
if test "$OPENWIN" = "y"
then
HELP=ow
HELPTITLE="Window System"
echo $HELPTITLE
CONT=NO
while test "$CONT" = "NO"
do
Title "Builder Xcessory Links Installation"
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo "The MIT X11 Distribution directory structure differs from the"
echo "Sun Open Windows X11/NeWS directory structure. In order for"
echo "the Builder Xcessory to be installed properly, the X11 server"
echo "being used must be known."
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
HELP=ow
HELPTITLE="Window System"
PromptUser "Do you want to install for Open Windows?" "y"
if test "$USERPROMPT" != ""
then
case "$USERPROMPT"
in
[Nn] | [Nn][Oo])
USEOPENWIN=NO
CONT=YES
;;
[Yy] | [Yy][Ee] | [Yy][Ee][Ss])
USEOPENWIN=YES
CONT=YES
;;
*)
echo ""
echo "Please answer y or n"
CONT=NO
;;
esac
else
CONT=YES
USEOPENWIN=YES
fi
done
else
USEOPENWIN=NO
fi
#
# Destination Defaults
#
if test "${USEOPENWIN}" = "YES"
then
if test "${OPENWINHOME}" != ""
then
SERVERLIB=${OPENWINHOME}/lib
BX_HOME=${OPENWINHOME}/lib
BIN_DEST=${OPENWINHOME}/bin
MAN_DEST=${OPENWINHOME}/man
else
SERVERLIB=/usr/openwin/lib
BX_HOME=/usr/openwin/lib
BIN_DEST=/usr/openwin/bin
MAN_DEST=/usr/openwin/man
fi
else
SERVERLIB=/usr/lib/X11
BX_HOME=/usr/lib/X11
BIN_DEST=/usr/bin/X11
MAN_DEST=/usr/man
fi
APP_DEST=${SERVERLIB}/app-defaults
if test "$CATMAN" = "y"
then
SUB_MAN=cat
else
SUB_MAN=man
fi
if test "${SHORT_NAMES}" = "y"
then
OLD_DEST=${BX_HOME}/bX
TMP_DEST=${BX_HOME}/bX
STANDARD_LIB_DEST=/usr/lib/X11/bX
APP_SRC=BX
else
OLD_DEST=${BX_HOME}/builderXcessory
TMP_DEST=${BX_HOME}/builderXcessory
STANDARD_LIB_DEST=/usr/lib/X11/builderXcessory
APP_SRC=BuilderXcessory
fi
if test "$UNCOMPRESS" = "y"
then
LIST="./bin/bx.Z ./XmAppl.uil"
else
LIST="./bin/bx ./XmAppl.uil"
fi
BIN_SRC=bin/bx
KEYSYMS=bindings/XKeysymDB
ALL_MAN=man
MAN_SRC=${ALL_MAN}/${SUB_MAN}
REL_NOTES=RELEASE_NOTES
BUG_RPT=BUG_REPORT
LIB_LIST="./bindings ./collections ./examples ./functions ./functions.ansi ./help ./items ./pixmaps ./styles ./wml ./man ./bin ./lib"
REMOVE_LIST="${LIB_LIST} ./${REL_NOTES} ./${BUG_RPT} ./${APP_SRC} ./XmAppl.uil"
MAN1_LIST="lmgrd.1 lmstat.1 lmhostid.1 lmdown.1 lmremove.1 lmreread.1"
MAN5_LIST="license.dat.5 license.opt.5"
#
# Misc variables.
#
cwd='/bin/pwd'
CONT=NO
if [ $DEBUGYN = "Y" ]
then
echo Running BuilderXcessory installation script in debug mode.
echo No commands which cause changes will be executed.
fi
GO=NO
while test "$GO" = "NO"
do
CONT=NO
while test "$CONT" = "NO"
do
HELP="linkmain"
HELPTITLE="Main Menu"
Title "Builder Xcessory Links Installation"
echo ""
Status "echo"
echo ""
echo ""
echo 1. Change BX Home Directory.
echo 2. Change Binary Directory.
echo 3. Change Application Defaults Directory.
echo 4. Change Manual Pages Directory.
echo 5. Change X Data Files Directory.
echo I. INSTALL BX LINKS AS CONFIGURED.
echo Q. QUIT.
echo ""
echo ""
echo ""
echo ""
echo ${DASHN} "Selection (? for Help):${SLASHC}"
read Z
echo ""
echo ""
case "$Z"
in
[Qq])
echo "Quit by user from Main Menu."
exit
;;
[Ii])
CONT=YES
;;
\?)
InstallHelp
;;
1)
PromptUser "Enter new BX home directory" $TMP_DEST
OLD_DEST=${TMP_DEST}
TMP_DEST=${USERPROMPT}
if test "$TMP_DEST" != "$OLD_DEST"
then
DESTOK=N
fi
;;
2)
PromptUser "Enter new binary directory" ${BIN_DEST}
BIN_DEST=${USERPROMPT}
;;
3)
PromptUser "Enter new defaults directory" ${APP_DEST}
APP_DEST=${USERPROMPT}
;;
4)
PromptUser "Enter new manual page directory" ${MAN_DEST}
MAN_DEST=${USERPROMPT}
;;
5)
PromptUser "Enter the X data file directory" ${SERVERLIB}
SERVERLIB=${USERPROMPT}
;;
*)
;;
esac
done
if [ ! -d $TMP_DEST ]
then
Clear
Title "W A R N I N G"
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo "${TMP_DEST} does not exist"
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
AwaitEnter
CONT="NO"
GO=NO
TMP_DEST=${OLD_DEST}
else
GO=YES
fi
done
LOGFILE=${TMP_DEST}/linklog.${HOSTNAME}
echo "" > $LOGFILE
Log "Creating links for Builder Xcessory on `date`."
Clear
Title "Creating System Links"
Status "Log"
echo ""
if test "$DEBUGYN" = "Y"
then
LINKFILE=./links.${HOSTNAME}
else
LINKFILE=${TMP_DEST}/links.${HOSTNAME}
fi
Log "Creating links..."
if test "$DEBUGYN" = "N"
then
sed -e "s?${STANDARD_LIB_DEST}?${TMP_DEST}?g" \
${TMP_DEST}/${APP_SRC}.ad > ${TMP_DEST}/${APP_SRC}.tmp
fi
DEBUG mv ${TMP_DEST}/${APP_SRC}.tmp ${TMP_DEST}/${APP_SRC}.${HOSTNAME}
Log "Removing old links (if they exist)"
if test -f ${LINKFILE}
then
DEBUG rm -f `cat ${LINKFILE}`
fi
DEBUG rm -f ${LINKFILE}
DEBUG rm -f ${BIN_DEST}/bx
DEBUG rm -f ${APP_DEST}/${APP_SRC}
DEBUG rm -f /usr/lib/bx.o
DEBUG rm -f /usr/man/man1/bx.1
for i in $MAN1_LIST
do
DEBUG rm -f ${MAN_DEST}/${SUB_MAN}1/$i
done
for i in $MAN5_LIST
do
DEBUG rm -f ${MAN_DEST}/${SUB_MAN}5/$i
done
echo ""
echo "In the following, {BX} is used to represent"
echo " ${TMP_DEST}."
echo ""
echo ${BIN_DEST}/bx >> ${LINKFILE}
if [ -d "${BIN_DEST}" ]
then
Log "${LN} {BX}/${BIN_SRC} ${BIN_DEST}/bx"
DEBUG ${LN} ${TMP_DEST}/${BIN_SRC} ${BIN_DEST}/bx
else
Log "${BIN_DEST} does not exist...creating"
DEBUG ${MKDIR} ${BIN_DEST}
Log "${LN} {BX}/${BIN_SRC} ${BIN_DEST}/bx"
DEBUG ${LN} ${TMP_DEST}/${BIN_SRC} ${BIN_DEST}/bx
fi
echo ${APP_DEST}/${APP_SRC} >> ${LINKFILE}
if [ -d "${APP_DEST}" ]
then
Log "${LN} {BX}/${APP_SRC}.${HOSTNAME} ${APP_DEST}/${APP_SRC}"
DEBUG ${LN} ${TMP_DEST}/${APP_SRC}.${HOSTNAME} ${APP_DEST}/${APP_SRC}
else
Log "${APP_DEST} does not exist...creating"
DEBUG ${MKDIR} ${APP_DEST}
Log "${LN} {BX}/${APP_SRC}.${HOSTNAME} ${APP_DEST}/${APP_SRC}"
DEBUG ${LN} ${TMP_DEST}/${APP_SRC}.${HOSTNAME} ${APP_DEST}/${APP_SRC}
fi
if [ -d "${MAN_DEST}/${SUB_MAN}1" ]
then
for i in $MAN1_LIST
do
DEBUG echo ${MAN_DEST}/${SUB_MAN}1/$i >> ${LINKFILE}
Log "${LN} {BX}/${MAN_SRC}1/$i ${MAN_DEST}/${SUB_MAN}1/$i"
DEBUG ${LN} ${TMP_DEST}/${MAN_SRC}1/$i ${MAN_DEST}/${SUB_MAN}1/$i
done
else
Log "${MAN_DEST}/${SUB_MAN}1 does not exist...creating"
DEBUG ${MKDIR} ${MAN_DEST}/${SUB_MAN}1
for i in $MAN1_LIST
do
DEBUG echo ${MAN_DEST}/${SUB_MAN}1/$i >> ${LINKFILE}
Log "${LN} {BX}/${MAN_SRC}1/$i ${MAN_DEST}/${SUB_MAN}1/$i"
DEBUG ${LN} ${TMP_DEST}/${MAN_SRC}1/$i ${MAN_DEST}/${SUB_MAN}1/$i
done
fi
if [ -d "${MAN_DEST}/${SUB_MAN}5" ]
then
for i in $MAN5_LIST
do
DEBUG echo ${MAN_DEST}/${SUB_MAN}5/$i >> ${LINKFILE}
Log "${LN} {BX}/${MAN_SRC}5/$i ${MAN_DEST}/${SUB_MAN}5/$i"
DEBUG ${LN} ${TMP_DEST}/${MAN_SRC}5/$i ${MAN_DEST}/${SUB_MAN}5/$i
done
else
Log "${MAN_DEST}/${SUB_MAN}5 does not exist...creating"
DEBUG ${MKDIR} ${MAN_DEST}/${SUB_MAN}5
for i in $MAN5_LIST
do
DEBUG echo ${MAN_DEST}/${SUB_MAN}5/$i >> ${LINKFILE}
Log "${LN} {BX}/${MAN_SRC}5/$i ${MAN_DEST}/${SUB_MAN}5/$i"
DEBUG ${LN} ${TMP_DEST}/${MAN_SRC}5/$i ${MAN_DEST}/${SUB_MAN}5/$i
done
fi
echo ""
AwaitEnter
#
# See if we need to install the OSF Keysyms
#
Clear
Title "Check for OSF Virtual Keysyms"
echo ""
Log "See if XKeysymDB exists and verify existance of OSF Virtual Keysyms"
if [ -f "${SERVERLIB}/XKeysymDB" ]
then
grep '^osf' ${SERVERLIB}/XKeysymDB > /dev/null
if [ $? -ne 0 ]
then
Log "${SERVERLIB}/XKeysymDB exists but contains no OSF Keysyms"
Log "Adding the OSF Virtual Keysyms to ${SERVERLIB}/XKeysymDB."
Log "Old XKeysymDB saved in ${SERVERLIB}/XKeysymDB.old"
DEBUG cp ${SERVERLIB}/XKeysymDB ${SERVERLIB}/XKeysymDB.old
DEBUG cat ${TMP_DEST}/${KEYSYMS} >> ${SERVERLIB}/XKeysymDB
else
echo ""
Log "${SERVERLIB}/XKeysymDB exists and contains OSF Keysyms"
fi
else
Log "${SERVERLIB}/XKeysymDB does not exist...creating"
DEBUG cp ${TMP_DEST}/${KEYSYMS} ${SERVERLIB}/XKeysymDB
fi
echo ""
echo "In order for the Motif Virtual Bindings to work properly,"
echo "the user of Builder Xcessory will need to have a binding set"
echo "up to map the OSF Virtual Keysyms to actual keys on his or her"
echo "keyboard. This is normally done via the Motif Window Manager"
echo "(mwm). If the user is not using mwm, he or she may set the"
echo "defaultVirtualBindings resource to do the mappings. The"
echo "directory:"
echo ""
echo " ${TMP_DEST}/bindings"
echo ""
echo "contains examples of this for various platforms."
echo ""
Log "Installation complete"